var app = getApp();
var webhost = app.globalData.webhost;
var util = require('../../utils/util.js')

Page({
  data: {
    id: '',
    data: {},
    dataList: [],
    reimAccCode:''
  },

  getReimSalaryDetail: function () {
    var that = this;
    var data = that.data.data;
    var dataList1 = that.data.dataList1;
    var dataList2 = that.data.dataList2;
    var dataList3 = that.data.dataList3;
    var driverAccount = app.globalData.driverAccount;
    var sessionid = app.globalData.sessionid;
    var id = that.data.id;
    var parameters = [{ String: { driverAccount: driverAccount, sessionid: sessionid, id: id } }];
    wx.request({
      url: webhost,
      data: {
        eap_username: "driver",
        eap_password: "Driver2018",
        boId: "tspdriver_tsp2DriverServiceBO_bo", //调用的bo
        methodName: 'getReimSalaryDetail', //调用的具体方法
        returnType: "json", //返回参数类型
        parameters: JSON.stringify(parameters)

      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'POST',
      success: function (res) {
        //获取到的数据中有值为null时，将其替换成''，并将'number'类型变量整理成float.2
        var curDataList1 = res.data.dataList1;
        var curDataList2 = res.data.dataList2;
        var curDataList3 = res.data.dataList3;
        var curData = res.data.data;
        util.number_in_obj_toF2(curData);
        util.number_in_objOfList_toF2(curDataList1);
        util.number_in_objOfList_toF2(curDataList2);
        util.number_in_objOfList_toF2(curDataList3);
        that.setData({
          dataList1: curDataList1,
          dataList2: curDataList2,
          dataList3: curDataList3,
          data: curData
        })
      }
    })

  },

  onLoad: function (options) {
    var that = this;
    var id = options.id;

    that.setData({
      id: id,
      reimAccCode: options.reimAccCode
    })

    that.getReimSalaryDetail();
  },

  onShow: function () {

  },

  onPullDownRefresh: function () {

  },

  onReachBottom: function () {

  },

  onShareAppMessage: function () {

  }
})